<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      dbus-1.12.16
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.79.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-9.1">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 9.1
      </h4>
      <h3>
        Chapter&nbsp;12.&nbsp;System Utilities
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="cups-pk-helper.html" title=
          "cups-pk-helper-0.2.6">Prev</a>
          <p>
            cups-pk-helper-0.2.6
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="elogind.html" title="elogind-243.4">Next</a>
          <p>
            elogind-243.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="sysutils.html" title=
          "Chapter&nbsp;12.&nbsp;System Utilities">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="dbus" name="dbus"></a>dbus-1.12.16
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to D-Bus
        </h2>
        <p>
          <span class="application">D-Bus</span> is a message bus system, a
          simple way for applications to talk to one another. <span class=
          "application">D-Bus</span> supplies both a system daemon (for
          events such as <span class="quote">&ldquo;<span class="quote">new
          hardware device added</span>&rdquo;</span> or <span class=
          "quote">&ldquo;<span class="quote">printer queue
          changed</span>&rdquo;</span>) and a per-user-login-session daemon
          (for general IPC needs among user applications). Also, the message
          bus is built on top of a general one-to-one message passing
          framework, which can be used by any two applications to communicate
          directly (without going through the message bus daemon).
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "https://dbus.freedesktop.org/releases/dbus/dbus-1.12.16.tar.gz">
                https://dbus.freedesktop.org/releases/dbus/dbus-1.12.16.tar.gz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 2dbeae80dfc9e3632320c6a53d5e8890
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 2.0 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 21 MB (add 17 MB for the
                tests)
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: 0.3 SBU (add 8.5 SBU for the tests)
              </p>
            </li>
          </ul>
        </div>
        <h3>
          D-Bus Dependencies
        </h3>
        <h4>
          Recommended
        </h4>
        <p class="recommended">
          <a class="xref" href="../x/x7lib.html" title="Xorg Libraries">Xorg
          Libraries</a> (for <span class=
          "command"><strong>dbus-launch</strong></span> program) <span class=
          "phrase">and <a class="xref" href="elogind.html" title=
          "elogind-243.4">elogind-243.4</a> (These are circular dependencies.
          First build without them, and then again after both packages are
          installed.)</span>
        </p>
        <h4>
          Optional
        </h4>
        <p class="optional">
          For the tests: <a class="xref" href="dbus-glib.html" title=
          "dbus-glib-0.110">dbus-glib-0.110</a>, <a class="xref" href=
          "python-modules.html#dbus-python" title="D-Bus Python-1.2.16">D-Bus
          Python-1.2.16</a>, <a class="xref" href=
          "python-modules.html#pygobject3" title=
          "PyGObject-3.34.0">PyGObject-3.34.0</a>, and <a class="xref" href=
          "valgrind.html" title="Valgrind-3.15.0">Valgrind-3.15.0</a>; for
          documentation: <a class="xref" href="doxygen.html" title=
          "Doxygen-1.8.17">Doxygen-1.8.17</a>, <a class="xref" href=
          "../pst/xmlto.html" title="xmlto-0.0.28">xmlto-0.0.28</a>,
          <a class="ulink" href=
          "https://pypi.python.org/pypi/mallard-ducktype">Ducktype</a>, and
          <a class="ulink" href=
          "http://ftp.gnome.org/pub/gnome/sources/yelp-tools/">Yelp Tools</a>
        </p>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/dbus">http://wiki.linuxfromscratch.org/blfs/wiki/dbus</a>
        </p>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of D-Bus
        </h2>
        <p>
          Install <span class="application">D-Bus</span> by running the
          following commands (you may wish to review the output from
          <span class="command"><strong>./configure --help</strong></span>
          first and add any desired parameters to the <span class=
          "command"><strong>configure</strong></span> command shown below):
        </p>
        <pre class="userinput">
<kbd class="command">./configure --prefix=/usr                        \
            --sysconfdir=/etc                    \
            --localstatedir=/var                 \
            --enable-user-session                \
            --disable-doxygen-docs               \
            --disable-xml-docs                   \
            --disable-static                     \
            --with-systemduserunitdir=no         \
            --with-systemdsystemunitdir=no       \
            --docdir=/usr/share/doc/dbus-1.12.16 \
            --with-console-auth-dir=/run/console \
            --with-system-pid-file=/run/dbus/pid \
            --with-system-socket=/run/dbus/system_bus_socket &amp;&amp;
make</kbd>
</pre>
        <p>
          See below for test instructions.
        </p>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">make install</kbd>
</pre>
        <p>
          The shared library needs to be moved to <code class=
          "filename">/lib</code>, and as a result the <code class=
          "filename">.so</code> file in <code class=
          "filename">/usr/lib</code> will need to be recreated. Run the
          following command as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">mv -v /usr/lib/libdbus-1.so.* /lib &amp;&amp;
ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so</kbd>
</pre>
        <p>
          If you are using a DESTDIR install, <span class=
          "command"><strong>dbus-daemon-launch-helper</strong></span> needs
          to be fixed afterwards. Issue, as <code class=
          "systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class=
"command">chown -v root:messagebus /usr/libexec/dbus-daemon-launch-helper &amp;&amp;
chmod -v      4750       /usr/libexec/dbus-daemon-launch-helper</kbd>
</pre>
        <p>
          If you are still building your system in chroot or you did not
          start the daemon yet, but you want to compile some packages that
          require <span class="application">D-Bus</span>, generate the
          <span class="application">D-Bus</span> UUID to avoid warnings when
          compiling some packages with the following command as the
          <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">dbus-uuidgen --ensure</kbd>
</pre>
        <p>
          If using <a class="xref" href="elogind.html" title=
          "elogind-243.4">elogind-243.4</a>, create a symlink to the
          <code class="filename">/var/lib/dbus/machine-id</code> file:
        </p>
        <pre class="root">
<kbd class="command">ln -sv /var/lib/dbus/machine-id /etc</kbd>
</pre>
        <p>
          The dbus tests cannot be run until after <a class="xref" href=
          "dbus-glib.html" title="dbus-glib-0.110">dbus-glib-0.110</a> has
          been installed. They must be run as an unprivileged user from a
          local session with bus address. To run the standard tests issue
          <span class="command"><strong>make check</strong></span>.
        </p>
        <p>
          If you want to run the unit regression tests, configure requires
          additional parameters which expose additional functionality in the
          binaries that are not intended to be used in a production build of
          <span class="application">D-Bus</span>. If you would like to run
          the tests, issue the following commands (for the tests, you don't
          need to build the docs):
        </p>
        <pre class="userinput">
<kbd class="command">make distclean                     &amp;&amp;
./configure --enable-tests         \
            --enable-asserts       \
            --disable-doxygen-docs \
            --disable-xml-docs     &amp;&amp;
make                               &amp;&amp;
make check</kbd>
</pre>
        <p>
          The test <span class="command"><strong>test-bus.sh</strong></span>
          is known to fail. There has also been reports that the tests may
          fail if running inside a Midnight Commander shell. You may get
          out-of-memory error messages when running the tests. These are
          normal and can be safely ignored.
        </p>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <em class="parameter"><code>--disable-doxygen-docs</code></em>:
          This switch disables doxygen documentation build and install, if
          you have <span class="application">doxygen</span> installed. If
          <span class="application">doxygen</span> is installed, and you wish
          to build them, remove this parameter.
        </p>
        <p>
          <em class="parameter"><code>--disable-xml-docs</code></em>: This
          switch disables html documentation build and install, if you have
          <span class="application">xmlto</span> installed. If <span class=
          "application">xmlto</span> is installed, and you wish to build
          them, remove this parameter.
        </p>
        <p>
          <em class="parameter"><code>--disable-static</code></em>: This
          switch prevents installation of static versions of the libraries.
        </p>
        <p>
          <em class="parameter"><code>--enable-user-session</code></em>: This
          parameter enables per-user DBus sessions with <span class=
          "phrase"><span class="application">elogind</span>.</span>
        </p>
        <p>
          <em class=
          "parameter"><code>--with-systemd{user,system}unitdir=no</code></em>:
          These switches disable installation of systemd units on elogind
          based systems.
        </p>
        <p>
          <em class=
          "parameter"><code>--with-console-auth-dir=/run/console</code></em>:
          This parameter specifies the directory to check for console
          ownerhip.
        </p>
        <p>
          <em class=
          "parameter"><code>--with-system-pid-file=/run/dbus/pid</code></em>:
          This parameter specifies the location of the PID file.
        </p>
        <p>
          <em class=
          "parameter"><code>--with-system-socket=/run/dbus/system_bus_socket</code></em>:
          This parameter specifies the location of the system bus socket.
        </p>
        <p>
          <em class="parameter"><code>--enable-tests</code></em>: Build extra
          parts of the code to support all tests. Do not use on a production
          build.
        </p>
        <p>
          <code class="option">--enable-embedded-tests</code>: Build extra
          parts of the code to support only unit tests. Do not use on a
          production build.
        </p>
        <p>
          <em class="parameter"><code>--enable-asserts</code></em>: Enable
          debugging code to run assertions for statements normally assumed to
          be true. This prevents a warning that '<em class=
          "parameter"><code>--enable-tests</code></em>' on its own is only
          useful for profiling and might not give true results for all tests,
          but adds its own NOTE that this should not be used in a production
          build.
        </p>
      </div>
      <div class="configuration" lang="en" xml:lang="en">
        <h2 class="sect2">
          Configuring D-Bus
        </h2>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="dbus-config" name="dbus-config"></a>
          </h3>
          <h4 class="title">
            <a id="dbus-config" name="dbus-config"></a>Config Files
          </h4>
          <p>
            <code class="filename">/etc/dbus-1/session.conf</code>,
            <code class="filename">/etc/dbus-1/system.conf</code> and
            <code class="filename">/etc/dbus-1/system.d/*</code>
          </p>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="dbus-session-config" name="dbus-session-config"></a>
          </h3>
          <h4 class="title">
            <a id="dbus-session-config" name=
            "dbus-session-config"></a>Configuration Information
          </h4>
          <p>
            The configuration files listed above should probably not be
            modified. If changes are required, you should create <code class=
            "filename">/etc/dbus-1/session-local.conf</code> and/or
            <code class="filename">/etc/dbus-1/system-local.conf</code> and
            make any desired changes to these files.
          </p>
          <p>
            If any packages install a <span class="application">D-Bus</span>
            <code class="filename">.service</code> file outside of the
            standard <code class="filename">/usr/share/dbus-1/services</code>
            directory, that directory should be added to the local session
            configuration. For instance, <code class=
            "filename">/usr/local/share/dbus-1/services</code> can be added
            by performing the following commands as the <code class=
            "systemitem">root</code> user:
          </p>
          <pre class="root">
<kbd class="command">cat &gt; /etc/dbus-1/session-local.conf &lt;&lt; "EOF"
<code class="literal">&lt;!DOCTYPE busconfig PUBLIC
 "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"&gt;
&lt;busconfig&gt;

  &lt;!-- Search for .service files in /usr/local --&gt;
  &lt;servicedir&gt;/usr/local/share/dbus-1/services&lt;/servicedir&gt;

&lt;/busconfig&gt;</code>
EOF</kbd>
</pre>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <h3 class="sect3">
            <a id="dbus-session" name="dbus-session"></a>
          </h3>
          <h4 class="title">
            <a id="dbus-session" name="dbus-session"></a>D-Bus Session Daemon
          </h4>
          <p>
            To automatically start <span class=
            "command"><strong>dbus-daemon</strong></span> when the system is
            rebooted, install the <code class=
            "filename">/etc/rc.d/init.d/dbus</code> bootscript from the
            <a class="xref" href="../introduction/bootscripts.html" title=
            "BLFS Boot Scripts">blfs-bootscripts-20191204</a> package.
          </p>
          <pre class="root">
<kbd class="command">make install-dbus</kbd>
</pre>
          <p>
            Note that this boot script only starts the system-wide
            <span class="application">D-Bus</span> daemon. Each user
            requiring access to <span class="application">D-Bus</span>
            services will also need to run a session daemon as well. There
            are many methods you can use to start a session daemon using the
            <span class="command"><strong>dbus-launch</strong></span>
            command. Review the <span class=
            "command"><strong>dbus-launch</strong></span> man page for
            details about the available parameters and options. Here are some
            suggestions and examples:
          </p>
          <div class="itemizedlist">
            <ul class="compact">
              <li class="listitem">
                <p>
                  Add <span class=
                  "command"><strong>dbus-launch</strong></span> to the line
                  in the <code class="filename">~/.xinitrc</code> file that
                  starts your graphical desktop environment.
                </p>
              </li>
              <li class="listitem">
                <p>
                  If you use <span class=
                  "command"><strong>xdm</strong></span> or some other display
                  manager that calls the <code class=
                  "filename">~/.xsession</code> file, you can add
                  <span class="command"><strong>dbus-launch</strong></span>
                  to the line in your <code class=
                  "filename">~/.xsession</code> file that starts your
                  graphical desktop environment. The syntax would be similar
                  to the example in the <code class=
                  "filename">~/.xinitrc</code> file.
                </p>
              </li>
              <li class="listitem">
                <p>
                  The examples shown previously use <span class=
                  "command"><strong>dbus-launch</strong></span> to specify a
                  program to be run. This has the benefit (when also using
                  the <em class=
                  "parameter"><code>--exit-with-session</code></em>
                  parameter) of stopping the session daemon when the
                  specified program is stopped. You can also start the
                  session daemon in your system or personal startup scripts
                  by adding the following lines:
                </p>
                <pre class="userinput">
<kbd class="command"><code class="literal"># Start the D-Bus session daemon
eval `dbus-launch`
export DBUS_SESSION_BUS_ADDRESS</code></kbd>
</pre>
                <p>
                  This method will not stop the session daemon when you exit
                  your shell, therefore you should add the following line to
                  your <code class="filename">~/.bash_logout</code> file:
                </p>
                <pre class="userinput">
<kbd class="command"><code class="literal"># Kill the D-Bus session daemon
kill $DBUS_SESSION_BUS_PID</code></kbd>
</pre>
              </li>
              <li class="listitem">
                <p>
                  A hint has been written that provides ways to start scripts
                  using the KDM session manager of KDE. The concepts in this
                  hint could possibly be used with other session managers as
                  well. The hint is located at <a class="ulink" href=
                  "http://www.linuxfromscratch.org/hints/downloads/files/execute-session-scripts-using-kdm.txt">
                  http://www.linuxfromscratch.org/hints/downloads/files/execute-session-scripts-using-kdm.txt</a>.
                </p>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">dbus-cleanup-sockets, dbus-daemon,
              dbus-launch, dbus-monitor, dbus-run-session, dbus-send,
              dbus-test-tool, dbus-update-activation-environment, and
              dbus-uuidgen</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Library:</strong>
              <span class="segbody">libdbus-1.so</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/etc/dbus-1, /usr/{include,lib}/dbus-1.0,
              /usr/lib/cmake/DBus1, /usr/share/dbus-1, /usr/share/xml/dbus-1,
              /usr/share/doc/dbus-1.12.16, and /var/{lib,run}/dbus</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="dbus-cleanup-sockets" name=
                    "dbus-cleanup-sockets"></a><span class=
                    "term"><span class="command"><strong>dbus-cleanup-sockets</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to clean up leftover sockets in a directory.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-daemon" name="dbus-daemon"></a><span class=
                    "term"><span class=
                    "command"><strong>dbus-daemon</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is the <span class="application">D-Bus</span> message bus
                    daemon.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-launch" name="dbus-launch"></a><span class=
                    "term"><span class=
                    "command"><strong>dbus-launch</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to start <span class=
                    "command"><strong>dbus-daemon</strong></span> from a
                    shell script. It would normally be called from a user's
                    login scripts.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-monitor" name="dbus-monitor"></a><span class=
                    "term"><span class=
                    "command"><strong>dbus-monitor</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to monitor messages going through a <span class=
                    "application">D-Bus</span> message bus.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-run-session" name=
                    "dbus-run-session"></a><span class="term"><span class=
                    "command"><strong>dbus-run-session</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    start a process as a new <span class=
                    "application">D-Bus</span> session.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-send" name="dbus-send"></a><span class=
                    "term"><span class=
                    "command"><strong>dbus-send</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to send a message to a <span class=
                    "application">D-Bus</span> message bus.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-test-tool" name=
                    "dbus-test-tool"></a><span class="term"><span class=
                    "command"><strong>dbus-test-tool</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is a <span class="application">D-Bus</span> traffic
                    generator and test tool; it is a multi-purpose tool for
                    debugging and profiling <span class=
                    "application">D-Bus</span>.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-update-activation-environment" name=
                    "dbus-update-activation-environment"></a><span class=
                    "term"><span class=
                    "command"><strong>dbus-update-activation-environment</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to update the environment used for <span class=
                    "application">D-Bus</span> session services; it updates
                    the list of environment variables used by <span class=
                    "command"><strong>dbus-daemon --session</strong></span>
                    when it activates session services without using systemd.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="dbus-uuidgen" name="dbus-uuidgen"></a><span class=
                    "term"><span class=
                    "command"><strong>dbus-uuidgen</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is used to generate a universally unique ID.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="libdbus-1" name="libdbus-1"></a><span class=
                    "term"><code class="filename">libdbus-1.so</code></span>
                  </p>
                </td>
                <td>
                  <p>
                    contains the API functions used by the <span class=
                    "application">D-Bus</span> message daemon. <span class=
                    "application">D-Bus</span> is first a library that
                    provides one-to-one communication between any two
                    applications; <span class=
                    "command"><strong>dbus-daemon</strong></span> is an
                    application that uses this library to implement a message
                    bus daemon.
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-02-15 20:23:35 -0800
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="cups-pk-helper.html" title=
          "cups-pk-helper-0.2.6">Prev</a>
          <p>
            cups-pk-helper-0.2.6
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="elogind.html" title="elogind-243.4">Next</a>
          <p>
            elogind-243.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="sysutils.html" title=
          "Chapter&nbsp;12.&nbsp;System Utilities">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 9.1">Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
